package com.bovy.speed;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Grep {

	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new FileReader(new File("log.txt")));
			String str = null;
			List<String> l = new ArrayList<String>();
			Pattern p = Pattern.compile("extra=([^&]+)&");
			while( (str=br.readLine()) !=null ) {
				Matcher m = p.matcher(str);
				while(m.find()) {
					 System.out.println("=========="+m.group());
				}
				try{
					str = str.substring(str.indexOf("extra="));
					str = str.substring(6,str.indexOf("&"));
					System.out.println(str);
					l.add(str);
				} catch(Exception e){
//					System.out.println("=========="+str);
				}
				
				
			}
			StringBuffer sb = new StringBuffer();	
			sb.append("(");
			for(String s:l) {
				sb.append(s).append(",");
			}
			sb.append("0)");
			System.out.println(sb.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
